<include file="Public:header" />
<script>
$(document).ready(function(e) {
    $('.showcurimg').each(function(index, element) {
        $(this).click(function(e) {
            $(this).find('img').show();
        });
		$(this).mouseleave(function(e) {
            $(this).find('img').hide();
        });
    });
}); 



/*function selectNews(id){
	
	var ids = new Array();
	$('#news_ids input[value!="'+id+'"]').each(function(index, element){
		ids.push($(this).val());
	});
	if($('#news_ids input[value="'+id+'"]').length <=0){
		ids.push(id);
	}
	$.ajax({
		url:"{:U('selectNews')}",
		data:"id="+id+"&modules_id={$modules_id}",
		dataType:"json",
		type:'POST',
		success: function(data){ 
			if(data.status == 1){
				if(data.type==1){
					$('#title'+id).addClass('selectednews');
					$(window.parent.document).find('#NewsList_').append('<li sortkey="0" id="news1_'+id+'" style="border:1px solid #ccc; width:100px; position:relative; height:100px; margin:4px; float:left;"><img src="'+$('#title'+id).attr('imgurl')+'" width="100%" height="100%"><a href="javascript:void(0);" onclick="sortListInfo(\'up\',this)" style="position:absolute; left:0px; bottom:0px;">[&lt;]</a> <a href="javascript:void(0);" onclick="sortListInfo(\'down\',this)" style="position:absolute; bottom:0px; right:0px;">[&gt;]</a><a href="javascript:;" onClick="removeListInfoCate('+id+',1);" style="font-size:20px; height:24px; width:24px; line-height:24px; text-align:center; position:absolute; top:0px; right:0px; color:#fff; background:#f00; border-radius:20px;">×</a></li>');
				}else{
					$('#title'+id).removeClass('selectednews');
					$(window.parent.document).find('#NewsList_ #news1_'+id).remove();
					
				}
			}else{
				alert(data.info);
			}
		}
	});
}*/


function selectNews(id, img, title){
	var box = art.dialog.data('relateidsBox');
	if(box.find("#thumbnail_"+id).length > 0){
		box.find("#thumbnail_"+id).parent().remove();
		$('#title'+id).removeClass('selectednews');
	}else{
		//alert(box.find('.thumbnail').length);
	    if(box.find('.thumbnail').length == 1){
		alert('请删除原来的商品，然后重新选择。');
		return false;
		}
		
        $('#title'+id).addClass('selectednews');
	    $('<div style="position:relative;" class="col-sm-3 col-md-3"><div class="thumbnail" id="thumbnail_'+id+'"><img src="'+img+'" data-holder-rendered="true" style="height: 100px; display: block;"><div class="caption"><h3 style="font-size:12px;">'+title+'</h3><input type="hidden" name="relateids" value="'+id+'"></div></div><a style="position:absolute; top:0px; right:10px; display:inline-block; width:30px; height:30px; line-height:30px; text-align:center; background:#f00; color:#fff;" onClick="$(this).parent().remove();" href="##">x</a></div>').appendTo(box);
	}
	
}



</script>	
<style> 
.header{display:none;}
	.w790{margin-top:0px;}
	.selectednews{color:#0F0; font-weight:bold;}
</style>

<div class="alert alert-warning" role="alert">
      <strong>温馨提示:</strong> 点击商品标题增加或减少关联商品。
    </div>
<div id="news_ids">
    <volist name="modules" id="vo">
    <input type="hidden" value="{$vo.id}" />
    </volist>
</div>
<div class="container main"> <include file="Public:left" />
  <div class="w790">
    <div class="h">
      <form action="{:U('selectProduct')}" method="get" class="fr form-inline">
      <label class="checkbox-inline"><input name="status" type="checkbox" <eq name="status" value="1">checked="ckecked"</eq> value="1" />状态</label>
      <label class="checkbox-inline"><input name="is_hot" type="checkbox" <eq name="is_hot" value="1">checked="ckecked"</eq> value="1" />热门</label>
      <label class="checkbox-inline"><input name="is_rec" type="checkbox" <eq name="is_rec" value="1">checked="ckecked"</eq> value="1" />推荐</label>
      <label class="checkbox-inline"><input name="is_top" type="checkbox" <eq name="is_top" value="1">checked="ckecked"</eq> value="1" />置顶</label>
      
      
      <select name="category_id" id="pid" class="form-control">
          <option value="0">请选择栏目</option>
          <volist name="pid_list" id="vo">
            <option <eq name="category_id" value="$vo['id']">selected="selected"</eq> value="{$vo.id}">{$vo.title}</option>
            <volist name="vo['sub']" id="svo">
               <option <eq name="category_id" value="$svo['id']">selected="selected"</eq> value="{$svo.id}">{:getdeepstr($svo['deep'])}{$svo.title}</option>
            </volist>
          </volist>
        </select>
        
        <input type="hidden" name="pagesize" value="{$pagesize}" />
        <input type="text" name="keywords" placeholder="输入搜索关键词" class="form-control" value="{$keywords}" />
        <button type="submit" class="btn btn-default">搜索</button>
      </form>
      
      
      <div style="clear:both;"></div>
      
      </div>
    <div class="table_">
      <table class="table table-bordered" width="100%" border="0" cellspacing="0" cellpadding="0">
        <thead>
          <tr>

            <td align="center">标题</td>

            <td align="center">所属分类</td>
            <td align="center">状态</td>
           
          </tr>
        </thead>
        <volist name="list" id="vo">
          <tr class="data_list">
            
            <td><a href="javascript:;" id="title{$vo.id}" class="<if condition="in_array($vo['id'],$selectedid)">selectednews</if>" onclick="selectNews({$vo.id},'{:getThumbPath($vo['img_url'])}','{$vo.title}');" imgurl="{:getThumbPath($vo['img_url'])}">{$vo.title}</a><notempty name="vo['img_url']">(<a class="showcurimg" href="#">图<img src="{:getThumbPath($vo['img_url'])}" style="width:100px; position:absolute; margin-top:0px; display:none;" /></a>)</notempty></td>
            
            <td align="center">{$vo.category_name}</td>
            <td align="center"><eq name="vo['status']" value="1"><span class="status1 status_btn" field="status,{$vo.id}"></span>
                <else/>
                <span class="status0 status_btn" field="status,{$vo.id}"></span></eq></td>
            
          </tr>
        </volist>
      </table>
      <div class="pages">
        
        <form class="fr" style="display:inline;" id="pagesize" action="" method="get">
          每页
          <select name="pagesize" onchange="document.getElementById('pagesize').submit();">
            <option 
            <eq name="pagesize" value="10">selected="selected"</eq>
             value="10">10
            </option>
            <option 
            <eq name="pagesize" value="20">selected="selected"</eq>
             value="20">20
            </option>
            <option 
            <eq name="pagesize" value="30">selected="selected"</eq>
             value="30">30
            </option>
            <option 
            <eq name="pagesize" value="50">selected="selected"</eq>
             value="50">50
            </option>
            <option 
            <eq name="pagesize" value="100">selected="selected"</eq>
             value="100">100
            </option>
            <option 
            <eq name="pagesize" value="500">selected="selected"</eq>
             value="500">500
            </option>
          </select>
          条
          <input type="hidden" name="modules_id" value="{$modules_id}" />
          <input type="hidden" name="category_id" value="{$category_id}" />
          <input type="hidden" name="keywords" value="{$keywords}" />
        </form>
        <div class="fr">{$pages}</div>
      </div>
    </div>
  </div>
  <div class="clear"></div>
</div>



        
        
        
<include file="Public:footer" />